﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe Name="CreateExtender" xmlns="http://schemas.microsoft.com/pag/gax-core"
                               xmlns:xi="http://www.w3.org/2001/XInclude" Bound="false">
  <xi:include href="../Common/CommonTypeAliases.xml"
				xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Types)" />
  <Caption>Extender</Caption>
  <Description>Extender</Description>
  <HostData>
    <Icon File="Resources\Extender.ico" />
    <CommandBar Menu="VSSDKAssistProjectCreate"/>
  </HostData>
  <Arguments>
    <xi:include href="../Common/CommonArguments.xml"
					  xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Arguments/gax:Argument)" />
    <Argument Name="VSPackageProject" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.VisualStudio.CurrentlySelectedProjectValueProvider, VSSDKAssist.Assets"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="VSPackageCodeClass" Type="EnvDTE.CodeClass, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.VSPackageCodeClassValueProvider, VSSDKAssist" 
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="VSPackageProjectNamespace" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="$(VSPackageProject.Properties.Item('DefaultNamespace').Value.ToString())"
                     Stage="OnBeginRecipe">
      </ValueProvider>
    </Argument>
    <Argument Name="TypeOfExtender" Type="VSSDKAssist.Enums.ExtenderType, VSSDKAssist"/>
    <Argument Name="CommonDestinationFolder" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="Common"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="DestinationFolder" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="Extenders"
                     Stage="OnBeginRecipe" />
    </Argument>
    <Argument Name="ExtenderName" Required="true">
      <Converter Type="VSSDKAssist.Assets.Converters.CSharpIdentifierConverter, VSSDKAssist.Assets"/>
    </Argument>
    <Argument Name="LanguageExtension" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.VisualStudio.CurrentlySelectedProjectLanguageValueProvider, VSSDKAssist.Assets"
               Stage="OnBeginRecipe">
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderBaseFileName" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="ExtenderBase.$(LanguageExtension)"
                     Stage="OnBeginRecipe">
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderFileName">
      <ValueProvider Type="Evaluator"
                     Expression="$(ExtenderName).$(LanguageExtension)"
                     Stage="OnBeginRecipe">
        <MonitorArgument Name="ExtenderName"/>
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderProviderName">
      <ValueProvider Type="Evaluator"
                     Expression="$(ExtenderName)Provider"
                     Stage="OnBeginRecipe">
        <MonitorArgument Name="ExtenderName"/>
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderProviderFileName">
      <ValueProvider Type="Evaluator"
                     Expression="$(ExtenderName)Provider.$(LanguageExtension)"
                     Stage="OnBeginRecipe">
        <MonitorArgument Name="ExtenderName"/>
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderNamespace" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="$(VSPackageProjectNamespace).$(DestinationFolder)"
                     Stage="OnBeginRecipe">
        <MonitorArgument Name="VSPackageProjectNamespace"/>
        <MonitorArgument Name="DestinationFolder"/>
      </ValueProvider>
    </Argument>
    <Argument Name="CommonExtenderNamespace" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="$(VSPackageProjectNamespace).$(CommonDestinationFolder)"
                     Stage="OnBeginRecipe">
        <MonitorArgument Name="VSPackageProjectNamespace"/>
        <MonitorArgument Name="CommonDestinationFolder"/>
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderBaseTT">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.TTPathValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"
                     SubPath="Extender"
                     TTFile="ExtenderBase.tt">
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderTT">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.TTPathValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"
                     SubPath="Extender"
                     TTFile="Extender.tt">
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderProviderTT">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.TTPathValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"
                     SubPath="Extender"
                     TTFile="ExtenderProvider.tt">
      </ValueProvider>
    </Argument>
    <Argument Name="ProvideExtenderAttributeTT">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.TTPathValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"
                     SubPath="Extender"
                     TTFile="ProvideExtenderAttribute.tt">
      </ValueProvider>
    </Argument>
    <Argument Name="ProvideObjectAttributeTT">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.TTPathValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"
                     SubPath="Extender"
                     TTFile="ProvideObjectAttribute.tt">
      </ValueProvider>
    </Argument>
    <Argument Name="ExtenderProviderGuid" Type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.Framework.GuidValueProvider, VSSDKAssist.Assets"
                     Stage="OnBeginRecipe"/>
    </Argument>
  </Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
      <Pages>
        <Page Type="VSSDKAssist.Recipes.CreateExtender.CreateExtenderCP, VSSDKAssist"
            Height="200" Width="510">
          <Title>Specify extender general properties</Title>
          <LinkTitle>Extender general properties</LinkTitle>
        </Page>
      </Pages>
    </Wizard>
  </GatheringServiceData>
  <Actions CoordinatorServiceType="VSSDKAssist.Recipes.Common.Coordinators.ExecutionProgressCoordinator, VSSDKAssist">
    <!-- Add a references-->
    <Action Name="AddReference1"
            Type="VSSDKAssist.Assets.Actions.VisualStudio.VisualStudio.AddProjectReferenceAction, VSSDKAssist.Assets"
            ReferencedAssembly="VSLangProj.dll"
            StatusMessage="Adding references"
            WriteMessageToOutputWindow="true">
      <Input Name="ReferringProject" RecipeArgument="VSPackageProject"/>
    </Action>
    <Action Name="AddReference2"
            Type="VSSDKAssist.Assets.Actions.VisualStudio.VisualStudio.AddProjectReferenceAction, VSSDKAssist.Assets"
            ReferencedAssembly="EnvDTE.dll">
      <Input Name="ReferringProject" RecipeArgument="VSPackageProject"/>
    </Action>
    <!--Create Folders-->
    <Action Name="GenerateCommonDestinationFolder"
          Type="VSSDKAssist.Assets.Actions.VisualStudio.AddProjectFolderAction, VSSDKAssist.Assets"
          StatusMessage="Creating destination folders"
          WriteMessageToOutputWindow="true">
      <Input Name="FolderName" RecipeArgument="CommonDestinationFolder"/>
      <Output Name="FolderAdded" />
    </Action>
    <Action Name="GenerateDestinationFolder"
          Type="VSSDKAssist.Assets.Actions.VisualStudio.AddProjectFolderAction, VSSDKAssist.Assets">
      <Input Name="FolderName" RecipeArgument="DestinationFolder"/>
      <Output Name="FolderAdded" />
    </Action>
    <!--Create Classes-->
    <Action Name="GenerateExtenderBaseContent"
          Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
          StatusMessage="Creating extender classes"
          WriteMessageToOutputWindow="true">
      <Input Name="Template" RecipeArgument="ExtenderBaseTT"/>
      <Input Name="CommonExtenderNamespace" RecipeArgument="CommonExtenderNamespace"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddExtenderBaseContent"
          Type="VSSDKAssist.Assets.Actions.VisualStudio.AddItemFromStringToProjectItemAction, VSSDKAssist.Assets"
          Open="true">
      <Input Name="Content" ActionOutput="GenerateExtenderBaseContent.Content" />
      <Input Name="TargetFileName" RecipeArgument="ExtenderBaseFileName"/>
      <Input Name="InputProjectItem" ActionOutput="GenerateCommonDestinationFolder.FolderAdded" />
    </Action>
    <Action Name="GenerateExtenderContent"
          Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="ExtenderTT"/>
      <Input Name="CommonExtenderNamespace" RecipeArgument="CommonExtenderNamespace"/>
      <Input Name="ExtenderNamespace" RecipeArgument="ExtenderNamespace"/>
      <Input Name="TypeOfExtender" RecipeArgument="TypeOfExtender"/>
      <Input Name="ExtenderName" RecipeArgument="ExtenderName"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddExtenderContent"
          Type="VSSDKAssist.Assets.Actions.VisualStudio.AddItemFromStringToProjectItemAction, VSSDKAssist.Assets"
          Open="true">
      <Input Name="Content" ActionOutput="GenerateExtenderContent.Content" />
      <Input Name="TargetFileName" RecipeArgument="ExtenderFileName"/>
      <Input Name="InputProjectItem" ActionOutput="GenerateDestinationFolder.FolderAdded" />
    </Action>
    <Action Name="GenerateExtenderProviderContent"
          Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="ExtenderProviderTT"/>
      <Input Name="ExtenderNamespace" RecipeArgument="ExtenderNamespace"/>
      <Input Name="TypeOfExtender" RecipeArgument="TypeOfExtender"/>
      <Input Name="ExtenderProviderName" RecipeArgument="ExtenderProviderName"/>
      <Input Name="ExtenderName" RecipeArgument="ExtenderName"/>
      <Input Name="ExtenderProviderGuid" RecipeArgument="ExtenderProviderGuid"/>      
      <Output Name="Content" />
    </Action>
    <Action Name="AddExtenderProviderContent"
          Type="VSSDKAssist.Assets.Actions.VisualStudio.AddItemFromStringToProjectItemAction, VSSDKAssist.Assets"
          Open="true">
      <Input Name="Content" ActionOutput="GenerateExtenderProviderContent.Content" />
      <Input Name="TargetFileName" RecipeArgument="ExtenderProviderFileName"/>
      <Input Name="InputProjectItem" ActionOutput="GenerateDestinationFolder.FolderAdded" />
    </Action>
    <!--Add ProvideObject Attribute-->
    <Action Name="GenerateProvideObjectAttribute"
            Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="ProvideObjectAttributeTT"/>
      <Input Name="ExtenderNamespace" RecipeArgument="ExtenderNamespace"/>
      <Input Name="ExtenderProviderName" RecipeArgument="ExtenderProviderName"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddProvideObjectAttribute"
            Type="VSSDKAssist.Recipes.Common.Actions.InsertAttributeToCodeClassAction, VSSDKAssist">
      <Input Name="CodeClass" RecipeArgument="VSPackageCodeClass"/>
      <Input Name="AttributeValue" ActionOutput="GenerateProvideObjectAttribute.Content"/>
    </Action>
    <!--Add ProvideExtender Attribute-->
    <Action Name="GenerateProvideExtenderAttribute"
            Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="ProvideExtenderAttributeTT"/>
      <Input Name="ExtenderNamespace" RecipeArgument="ExtenderNamespace"/>
      <Input Name="ExtenderProviderName" RecipeArgument="ExtenderProviderName"/>
      <Input Name="TypeOfExtender" RecipeArgument="TypeOfExtender"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddProvideExtenderAttribute"
            Type="VSSDKAssist.Recipes.Common.Actions.InsertAttributeToCodeClassAction, VSSDKAssist">
      <Input Name="CodeClass" RecipeArgument="VSPackageCodeClass"/>
      <Input Name="AttributeValue" ActionOutput="GenerateProvideExtenderAttribute.Content"/>
    </Action>
  </Actions>
</Recipe>